import {Component, OnInit} from '@angular/core';

import {Router, ActivatedRoute, ParamMap} from '@angular/router';

@Component({
  selector: 'app-first',
  templateUrl: './first.component.html',
  styleUrls: ['./first.component.scss']
})
export class FirstComponent implements OnInit {
  id: number;

  constructor(private route: ActivatedRoute) {
  }

  ngOnInit() {
    // 获取动态路由传值
    this.route.params.subscribe(data => {
      console.log(data);
      this.id = data.id
    })
  }

}
